package tk.xboot.flink.cep.mc.events;

public class TemperatureEvent extends MonitoringEvent {
    private double temperature;

    public TemperatureEvent(int rackId, double temperature) {
        super(rackId);
        this.temperature = temperature;
    }

    public double getTemperature() {
        return temperature;
    }

    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof TemperatureEvent) {
            TemperatureEvent pe = (TemperatureEvent) obj;
            return pe.canEquals(this) && super.equals(pe) && temperature == pe.temperature;
        }

        return false;
    }

    @Override
    public int hashCode() {
        return 41 * super.hashCode() + Double.hashCode(temperature);
    }

    @Override
    public String toString() {
        return "(Power Event " + getRackId() + " , " + getTemperature() + ")";
    }

    public boolean canEquals(Object object) {
        return object instanceof TemperatureEvent;
    }

}
